

    
    
    $('#submit-btn-e').click(function(){
        var name  = $('input[name="row[name]"]').val();
        var des  = $('input[name="row[explanation]"]').val();
        var ids  = $('input[name="ids"]').val();
       $.post('question_cate/edit',{'row[name]':name,'row[explanation]':des,ids:ids},function(res){
        console.log(res);
        if(res.code == '1'){
            layer.msg('操作成功')
            setTimeout(function(){
                window.history.go(-1);
            },300)
        }
       },'json')
    })

    $('#submit-btn-a').click(function(){
        var name  = $('input[name="row[name]"]').val();
        var des  = $('input[name="row[explanation]"]').val();
       $.post('question_cate/add',{'row[name]':name,'row[explanation]':des},function(res){
        console.log(res);
        if(res.code == '1'){
            layer.msg('操作成功')
            setTimeout(function(){
                window.history.go(-1);
            },300)
        }
       },'json')
    })





define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'question_cate/index' + location.search,
                    add_url: 'question_cate/add',
                    edit_url: 'question_cate/edit',
                    del_url: 'question_cate/del',
                    // multi_url: 'question_cate/multi',
                    // import_url: 'question_cate/import',
                    table: 'child_q_class',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'q_class_id',
                sortName: 'q_class_id',
                showToggle: false,
                searchFormTemplate: 'customformtpl',
                searchFormVisible: true,
                search:false,
                showColumns:false,
                // showColumns: false,
                showExport: false,
                columns: [
                    [
                        {checkbox: false},
                        // {field: 'q_class_id', title: __('Q_class_id')},
                        {field: 'name', title: __('Name'), operate: 'LIKE'},
                        {field: 'q_count', title: __('Q_count')},
                        // {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        // {field: 'delete_time', title: __('Delete_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        // {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        // {field: 'wxapp_id', title: __('Wxapp_id')},
                        {field: 'explanation', title: __('Explanation'), operate: 'LIKE'},
                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});